<template>
  <px-dialog v-model="dialogVisible" draggable clickHideContent :loding="spcloading" :title="digtitle" width="1431" style="height: 95%" align-center>
    <spcAnalyzePosition :spcJob="spcJob" style="height: 100%" />
  </px-dialog>
</template>

<script lang="ts" setup>
import spcAnalyzePosition from "@/views/water/spc/spcsearch/spcAnalyzePosition.vue";
import { ref, onMounted, nextTick, watch, reactive, toRefs } from "vue";
const props = defineProps({
  jobIdList: {
    type: Array<string>,
    default: () => []
  }
});
const data = reactive({
  spcJob: [
    {
      jobId: "",
      indicatorName: ""
    }
  ],
  digtitle: "spc指标",
  spcloading: false
});
const { spcJob, digtitle, spcloading } = toRefs(data);
onMounted(() => {
  console.log(props.jobIdList);
});
watch(
  () => props.jobIdList,
  newOption => {
    console.log(newOption);
    console.log(props.jobIdList[0]);
    spcJob.value = [
      {
        jobId: props.jobIdList[0]?.specCode,
        indicatorName: props.jobIdList[0]?.specName
      }
    ];
    digtitle.value = props.jobIdList[0]?.specName;
    setTimeout(() => {
      console.log(spcJob.value);
      dialogVisible.value = true;
      spcloading.value = true;
    }, 100);
  }
);

const dialogVisible = ref(false);
const handleOpen = () => {
  // dialogVisible.value = true;
};

defineExpose({
  handleOpen
});
</script>
